// import variables from '@/styles/element-variables.scss'
import defaultSettings from '../../settings'
import { mts } from '../types'

const { showSettings, tagsView, fixedHeader, sidebarLogo, showHeader, title } =
  defaultSettings

const state = () => ({
  title,
  showSettings,
  showHeader,
  tagsView,
  fixedHeader,
  sidebarLogo
})

const mutations = {
  [mts.changeSetting]: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  }
}

const actions = {
  changeSetting({ commit }, data) {
    commit(mts.changeSetting, data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
